package net.xyuu.entity;

import javax.persistence.Entity;
import javax.validation.constraints.AssertTrue;

import org.thymeleaf.util.StringUtils;


public class UserRegisterForm extends User {

	private static final long serialVersionUID = 1L;

	private String confirmPassword;

	private boolean agree;

	public void setConfirmPassword(String confirmPassword) {
		this.confirmPassword = confirmPassword;
	}

	public void setAgree(boolean agree) {
		this.agree = agree;
	}

	@AssertTrue(message = "{validation.constraints.Agree.message}")
	public boolean isAgree() {
		return agree;
	}

	public String getConfirmPassword() {
		return confirmPassword;
	}

	@AssertTrue(message = "{validation.constraints.Same.message}")
	public boolean isValid() {
		return StringUtils.equals(confirmPassword, getPassword());
	}

}
